package com.txunda.zhuohired.fgt.manage.home;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import com.txunda.zhuohired.R;
import com.txunda.zhuohired.adapter.manage.home.ManagePartAdapter;
import com.txunda.zhuohired.aty.manage.home.ManagePartDetailsAty;
import com.txunda.zhuohired.aty.manage.home.PostPartJobAty;
import com.txunda.zhuohired.base.BaseFgt;

/**
 * 创建人： Txd_Cjh
 * 创建时间： 2018/3/10 16:20
 * 功能描述：兼职
 * 联系方式：jiahuanchen@126.com
 */

public class ManagePratFgt extends BaseFgt {

    @ViewInject(R.id.lv_fgt_manage_part)
    private ListView lv_fgt_manage_part;

    private ManagePartAdapter managePartAdapter;

    private int type = 1;

    @Override
    protected void immersionInit() {

    }

    @Override
    @OnClick({R.id.tv_part_new})
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {
            case R.id.tv_part_new://发布新职位
                startActivity(PostPartJobAty.class, null);
                break;
        }
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.fgt_manage_part;
    }

    @Override
    protected void initialized() {

    }

    @Override
    protected void requestData() {
        initAdapter();
    }

    private void initAdapter() {
        managePartAdapter = new ManagePartAdapter(getActivity());
        lv_fgt_manage_part.setAdapter(managePartAdapter);
        lv_fgt_manage_part.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                Bundle bundle = new Bundle();
                bundle.putString("type", String.valueOf(i));
                startActivity(ManagePartDetailsAty.class, bundle);
            }
        });
    }

    public static ManagePratFgt newInstance(int type) {
        ManagePratFgt fragment = new ManagePratFgt();
        fragment.type = type;
        return fragment;
    }

}
